﻿namespace Portal.Workflow.Model
{
    public class WfExecuteParamCls
    {
        public GlobalEnvCls oGlobalEnvCls;
        public WfParamCls[] WfParams = null;
        public string RecordId;
        public string WorkflowActionId;
        public string WorkflowDefId;
        public string SiteId;
        public string ExtraParam = "";
        public string MessageInfo = "";
        public string ObjectType="";
        public string[] ToUser=new string[0];
        public object SqlTransaction;
        public string WorkflowComment = "";
        public string ObjectCreatedBy = "";
        public EmployeeCls[] DedicateUsers;

        public string ResponsibleId="";
        public string Responsible="";
        public string JoinerId="";
        public string Joiner = "";
    }

    public class RetWfExecuteParamCls
    {
        public WfParamCls[] WfParams=null;
        public bool Error = false;
        public bool Done = false;
        public string ReturnMsg="";
        public string Url="";
        public string XmlData;
        public bool ReturnIsLink = false;
        public string Target="_self";
    }

    public class RetNextLinkParam
    {
        public string Url = "";
        public string Target = "_self";
    }

    public class WfParamCls
    {
        public string Field;
        public string DisplayText;
        public object Value;
        public bool Required;
        public System.Type DataType; 

        public WfParamCls()
        {
        }

        public WfParamCls(string _Field, System.Type _DataType,string _DisplayText, object _Value, bool _Required)
        {
            Field = _Field;
            Value = _Value;
            DataType = _DataType;
            DisplayText = _DisplayText;
            Required = _Required;
        }

        public WfParamCls(string _Field,System.Type _DataType, string _DisplayText, bool _Required)
        {
            Field = _Field;
            DataType = _DataType;
            DisplayText = _DisplayText;
            Value = null;
            Required = _Required;
        }
    }

    public interface IWfFunction
    {
        string WfFunctionId { get; }
        string Name { get; }
        string Description { get; }
        WfParamCls[] InParamFields { get; set; }
        RetWfExecuteParamCls Execute(
            WfExecuteParamCls oWfExecuteParamCls);
        RetNextLinkParam GetLinkUrl(
            WfExecuteParamCls oWfExecuteParamCls);
        string WsCommandText { get; }
        bool RunAtServer { get; }
    }
}
